1 00:00:01,410 --> 00:00:01,950 Okay. 2 00:00:01,950 --> 00:00:06,600 In this lecture, we're going to be taking a quick look at the lighting service, which allows you to 3 00:00:06,600 --> 00:00:08,250 customize lighting in your game. 4 00:00:08,400 --> 00:00:12,450 And we're just going to jump right into this and go into the first property of the lighting service, 5 00:00:12,450 --> 00:00:14,250 which is the ambient property. 6 00:00:14,340 --> 00:00:15,390 What does this do? 7 00:00:15,570 --> 00:00:22,170 Well, what this does is it changes the hue or the color of the light in the regions that are occluded 8 00:00:22,170 --> 00:00:23,150 from the sky. 9 00:00:23,160 --> 00:00:27,170 So any area that does not have direct visibility to the sky. 10 00:00:27,180 --> 00:00:33,540 So this shadowed area here, since it does not have direct visibility to the sky, if I change this 11 00:00:33,540 --> 00:00:37,650 ambient color, then whatever color here of the shadow is going to change. 12 00:00:38,490 --> 00:00:42,930 So if I want to make it darker, the shadow darker, I can decrease the color here. 13 00:00:42,930 --> 00:00:45,180 And as you can see, my shadow changes. 14 00:00:46,140 --> 00:00:51,690 Now, something interesting to note about this is that there's this other property here called Outdoor 15 00:00:51,690 --> 00:00:52,440 Ambient. 16 00:00:52,560 --> 00:00:56,630 And this is for areas that are not occluded from the sky. 17 00:00:56,640 --> 00:01:00,000 So all these surfaces that are directly facing the sky. 18 00:01:00,030 --> 00:01:04,350 This property here, this outdoor ambient property, is going to be affecting those. 19 00:01:04,350 --> 00:01:10,590 And this property has to be equal to or greater than the values that are in the ambient property. 20 00:01:11,100 --> 00:01:14,130 So let's say I want to make the outside super bright. 21 00:01:15,860 --> 00:01:21,050 Then I can go in here and I can change any of the colors in this property here. 22 00:01:21,110 --> 00:01:22,670 So let me just increase it here. 23 00:01:23,520 --> 00:01:26,530 And you see, I can change the color of the shadow around. 24 00:01:26,550 --> 00:01:32,760 But once I increase the numbers to be greater than any of the numbers in here, it's going to also change 25 00:01:32,760 --> 00:01:34,020 my outdoor ambient. 26 00:01:34,560 --> 00:01:40,650 So you might notice that when I increase the brightness of the secluded area, you'll notice that the 27 00:01:40,650 --> 00:01:43,460 brightness of the surrounding areas also increase. 28 00:01:43,470 --> 00:01:46,880 And that's because these numbers are becoming higher than the outdoor ambient. 29 00:01:46,890 --> 00:01:52,140 So once this ambient property becomes greater than the outdoor ambient colors, then this one takes 30 00:01:52,140 --> 00:01:53,730 priority over everything. 31 00:01:55,150 --> 00:01:59,620 So if you want to customize your shadows, you're going to want to make sure that any of the RGV values 32 00:01:59,620 --> 00:02:03,550 in here are lower than or equal to this outdoor ambient. 33 00:02:03,970 --> 00:02:07,350 So this controls the color of light in the non occluded areas of the map. 34 00:02:07,360 --> 00:02:11,260 So if I wanted to make light like green, let's make it green. 35 00:02:11,680 --> 00:02:16,210 And then I could go in here and make my shadows something like maybe blue or purple. 36 00:02:17,000 --> 00:02:18,170 When you do something like that. 37 00:02:19,620 --> 00:02:23,610 So I've got green light and purple or bluish shadows. 38 00:02:23,850 --> 00:02:25,740 And I'm going to undo all that. 39 00:02:26,940 --> 00:02:28,180 The next one here is brightness. 40 00:02:28,200 --> 00:02:29,070 This one's pretty simple. 41 00:02:29,070 --> 00:02:31,980 It's just how bright the lighting is in your game. 42 00:02:31,980 --> 00:02:35,400 So if I decrease it to one, as you can see, my game gets darker. 43 00:02:35,730 --> 00:02:37,770 And if I increase it to something like ten. 44 00:02:38,540 --> 00:02:40,370 The light is much brighter. 45 00:02:40,370 --> 00:02:42,110 So very simple property. 46 00:02:42,410 --> 00:02:44,500 The next property here is called Color shift. 47 00:02:44,600 --> 00:02:45,290 Bottom. 48 00:02:46,040 --> 00:02:54,590 And what this does is that it affects the hue of light that is reflected by surfaces not directly facing 49 00:02:54,590 --> 00:02:55,550 the sun. 50 00:02:55,850 --> 00:03:01,520 So basically this surface here, because it's directly facing the sun, this would not be affected by 51 00:03:01,520 --> 00:03:07,160 this property, but this face here that is not directly facing the sun, it's got a shadow on it will 52 00:03:07,160 --> 00:03:08,630 be affected by this property. 53 00:03:09,140 --> 00:03:13,850 So if I change the technology here to something like Voxel, you'll be able to see it easier. 54 00:03:14,240 --> 00:03:20,210 But once I start changing the color of this, you'll see the color of the shadow here or the the light 55 00:03:20,240 --> 00:03:23,290 being reflected by this face of my block change. 56 00:03:23,300 --> 00:03:25,250 So if I make it something like. 57 00:03:26,640 --> 00:03:27,750 Maybe red. 58 00:03:27,990 --> 00:03:29,790 You'll see how this face gets red. 59 00:03:29,790 --> 00:03:34,550 And it's only this face that is not directly looking towards the sun. 60 00:03:34,560 --> 00:03:36,750 Same thing with underneath here. 61 00:03:37,050 --> 00:03:44,010 You can kind of see how each of these faces that are not directly facing my sun are becoming red. 62 00:03:45,120 --> 00:03:50,160 And then for the color shift top, this is for all the faces that are directly facing the sun. 63 00:03:50,700 --> 00:03:53,610 And I'm pretty sure you can see this one in shadow map. 64 00:03:54,400 --> 00:03:58,540 So if I change the hue here, you'll see if I do something like yellow. 65 00:03:59,450 --> 00:04:00,530 Or something like that. 66 00:04:00,530 --> 00:04:06,200 You can see that all of the areas that have direct visibility to the sun have changed to this bluish 67 00:04:06,200 --> 00:04:06,730 hue. 68 00:04:06,740 --> 00:04:07,280 Right. 69 00:04:07,830 --> 00:04:12,750 But all of these faces that aren't directly facing towards the sun don't have that change. 70 00:04:13,400 --> 00:04:18,080 So as you can see, when I change this, this face is not affected at all. 71 00:04:19,380 --> 00:04:22,170 It only gets affected by this property right here. 72 00:04:22,470 --> 00:04:27,930 So just a reminder, this one is for the faces of parts that are facing arson. 73 00:04:28,570 --> 00:04:32,380 And this is for the faces of parts that are not facing the sun. 74 00:04:33,490 --> 00:04:36,990 The next property here is called Environment Diffuse Scale. 75 00:04:37,000 --> 00:04:38,770 And this one kind of. 76 00:04:38,800 --> 00:04:43,840 This one basically dictates how much light comes from the environment of your game. 77 00:04:43,840 --> 00:04:47,320 So how much brightness is coming from reflected objects? 78 00:04:47,320 --> 00:04:51,640 Because as you know, light can bounce off objects and illuminate other objects. 79 00:04:51,640 --> 00:04:57,010 But if I decrease this, if I place it to zero, you notice everything gets a lot dimmer. 80 00:04:57,010 --> 00:05:03,100 And that's because the light being reflected off of these parts are not illuminating My other parts, 81 00:05:03,100 --> 00:05:07,660 it's reducing how much light is coming from reflections in my game. 82 00:05:07,750 --> 00:05:15,370 This other one called Environment Specular Scale is this one's a property basically, I think mainly 83 00:05:15,370 --> 00:05:17,170 for like metallic objects. 84 00:05:17,170 --> 00:05:23,410 It kind of changes the reflectivity of like light bouncing off stuff. 85 00:05:23,410 --> 00:05:30,580 So a way to demonstrate this is that I could make a sphere here and I'm going to make it metal. 86 00:05:31,450 --> 00:05:35,200 So right now, as you can see, my metal is pretty reflective. 87 00:05:35,200 --> 00:05:40,600 But if I go and start decreasing this value here, you'll notice that my metal becomes less and less 88 00:05:40,600 --> 00:05:46,900 reflective to the point where there isn't much of a mirror like effect to my metal. 89 00:05:46,900 --> 00:05:51,850 But as I increase this, you'll notice that my metal becomes shinier and shinier. 90 00:05:53,610 --> 00:05:57,770 And you can kind of notice The Shining being applied to all our parts. 91 00:05:57,780 --> 00:06:00,510 As you can see, all our parts are becoming more shiny. 92 00:06:01,550 --> 00:06:04,370 But this mainly affects metallic parts. 93 00:06:05,510 --> 00:06:07,310 And we'll just leave it at the default for now. 94 00:06:07,970 --> 00:06:10,760 The other property here is called Global Shadows. 95 00:06:10,940 --> 00:06:14,070 And this sets whether or not objects can cast shadows. 96 00:06:14,090 --> 00:06:18,780 And it basically allows us to differentiate between indoor and outdoor settings. 97 00:06:18,800 --> 00:06:25,520 So if I disable this, the game sees this area that is being blocked by this part as no different from 98 00:06:25,520 --> 00:06:26,180 its surroundings. 99 00:06:26,180 --> 00:06:26,710 Right. 100 00:06:26,720 --> 00:06:29,630 This part is basically not casting any shadow. 101 00:06:29,660 --> 00:06:33,770 We don't have any distinction between indoor and outdoor areas. 102 00:06:33,920 --> 00:06:40,130 So if you leave this checked, then you can have different lighting inside of areas that are covered 103 00:06:40,130 --> 00:06:43,700 like in caves or in a house or whatever the case may be. 104 00:06:44,360 --> 00:06:51,080 The next property here is shadow softness, and this dictates how sharp the edges of shadows are going 105 00:06:51,080 --> 00:06:51,350 to be. 106 00:06:51,350 --> 00:06:56,360 So if I set this to zero, you can see that my shadows become very sharp. 107 00:06:56,360 --> 00:07:02,900 But as I increase this number, you'll notice that it becomes blurrier and blurrier and the line from 108 00:07:02,900 --> 00:07:08,040 shadow to light doesn't become as defined. 109 00:07:08,060 --> 00:07:09,890 It's blurry, right? 110 00:07:10,490 --> 00:07:13,190 So we'll leave this at the default of 0.2. 111 00:07:14,390 --> 00:07:19,520 Now, this other setting here, technology, this just changes which lighting system is going to be 112 00:07:19,520 --> 00:07:20,510 used for the game. 113 00:07:20,750 --> 00:07:27,980 The most realistic one is future lighting, but it's also the it's the most demanding performance wise 114 00:07:27,980 --> 00:07:29,210 of the technologies. 115 00:07:29,210 --> 00:07:30,920 So the default is shadow map. 116 00:07:31,040 --> 00:07:35,240 And there's some other ones in here called voxel and compatibility. 117 00:07:36,360 --> 00:07:38,520 So we'll just leave it on shadow map for now, though. 118 00:07:38,700 --> 00:07:40,410 Clock time, very simple. 119 00:07:40,410 --> 00:07:43,410 Just represents the number of hours in our game. 120 00:07:43,410 --> 00:07:51,300 So if I set it to 16, the time of day is currently at the 16th hour of the 24 hours in a day. 121 00:07:51,600 --> 00:07:59,100 If I set it to one, you can think of that as like 1:00 AM and then we have like 2 a.m., 3:00 AM, 122 00:07:59,460 --> 00:08:03,720 here is the afternoon and then this is 1:00 and so on. 123 00:08:04,350 --> 00:08:10,640 Geographic latitude represents the degree position of your latitude in your game. 124 00:08:10,650 --> 00:08:18,000 So zero is at the equator if you are on earth, zero degrees of latitude means you're on the equator. 125 00:08:18,510 --> 00:08:23,970 If this number starts increasing in the positive direction, that means you're going towards the northern 126 00:08:23,970 --> 00:08:24,780 hemisphere. 127 00:08:24,780 --> 00:08:28,770 And if it's going in the negative direction, you're going towards the southern hemisphere. 128 00:08:28,770 --> 00:08:32,700 And this changes the positioning of the sun in our game. 129 00:08:33,390 --> 00:08:39,240 So if we're at noon here right on the equator, the sun is basically almost directly overhead. 130 00:08:39,870 --> 00:08:45,570 But if we change our latitude to be something maybe more northerly, if we set it to something like 131 00:08:45,570 --> 00:08:51,390 45 degrees of latitude, you can see that our sun has shifted dramatically to a different direction. 132 00:08:52,010 --> 00:08:53,420 And we can keep changing this. 133 00:08:53,420 --> 00:08:57,320 We could go super high, up 65 degrees of latitude. 134 00:08:58,070 --> 00:09:01,070 Or we could go to 85 degrees latitude. 135 00:09:01,460 --> 00:09:04,790 And it's just changing the positioning of the sun for us. 136 00:09:05,240 --> 00:09:06,350 And we can also do the same. 137 00:09:06,350 --> 00:09:09,730 We can go in the southern hemisphere, go like -45. 138 00:09:09,740 --> 00:09:12,320 And again, the sun's position changes. 139 00:09:13,060 --> 00:09:17,440 Time of day gives you greater control for the time that you want your game to be. 140 00:09:17,440 --> 00:09:23,770 So I could set it to be like maybe eight in the morning, so eight and then maybe 837. 141 00:09:23,770 --> 00:09:27,160 And then we can set like a number of seconds here, like 44. 142 00:09:27,890 --> 00:09:30,980 And then it updates that in the clock time as well. 143 00:09:31,700 --> 00:09:40,430 But this just gives you easier control over the time instead of it being represented by some obscure 144 00:09:40,460 --> 00:09:41,570 decimal number. 145 00:09:42,360 --> 00:09:45,870 And then this last property here is called exposure compensation. 146 00:09:46,170 --> 00:09:51,940 And this goes from, I believe, negative three to positive three. 147 00:09:51,960 --> 00:09:53,190 Can it go higher than that? 148 00:09:53,220 --> 00:09:54,120 Yeah, it can. 149 00:09:54,150 --> 00:09:55,800 I'm pretty sure it goes. 150 00:09:56,830 --> 00:09:57,940 What is the max? 151 00:09:59,930 --> 00:10:02,590 Well, actually, I think I can go super high. 152 00:10:02,600 --> 00:10:03,380 Whatever. 153 00:10:03,710 --> 00:10:10,510 What this property does is it dictates how much light your camera observes. 154 00:10:10,520 --> 00:10:15,590 If you've ever noticed, like if you go outside when it's super sunny out and then you go back inside 155 00:10:15,590 --> 00:10:18,410 a building, you'll notice that the building is super dark. 156 00:10:18,410 --> 00:10:23,720 And the reason for that is because your pupils have constricted so much that they're barely letting 157 00:10:23,720 --> 00:10:29,390 any light through and they have to sit there and adjust to open back up to let more light into your 158 00:10:29,390 --> 00:10:31,250 eyes so you can see more clearly. 159 00:10:31,250 --> 00:10:33,350 This is what this property basically does. 160 00:10:33,500 --> 00:10:37,310 It changes how much light our camera here is taking in for our game. 161 00:10:37,700 --> 00:10:44,060 So if I want the camera to take in less light, like imagine your pupils are extremely constricted, 162 00:10:44,060 --> 00:10:47,510 I could set it to something like negative five and you can barely see anything. 163 00:10:47,510 --> 00:10:52,640 But let's say your pupils are super wide open and it's taken in a lot of light. 164 00:10:52,640 --> 00:10:56,300 I could set it to five and you can barely see. 165 00:10:56,300 --> 00:10:56,870 Right. 166 00:10:57,170 --> 00:10:59,030 So that's what that property does. 167 00:10:59,960 --> 00:11:03,770 And other than that, that's kind of the basic properties for lighting. 168 00:11:03,800 --> 00:11:11,360 There's also some other effects in here post-processing effects such as bloom, depth of field sunrays. 169 00:11:11,360 --> 00:11:15,280 We're not going to go too in depth into these if you want to learn more about them. 170 00:11:15,290 --> 00:11:18,950 I've attached articles to this lecture that you can go ahead and take a look at. 171 00:11:19,610 --> 00:11:24,050 But for Sunrays, this just changes the intensity of sunrays in your game. 172 00:11:24,050 --> 00:11:31,610 So if I said it's something like one super bright sun rays, you can see them glistening here as I move 173 00:11:31,610 --> 00:11:32,570 around the part. 174 00:11:33,590 --> 00:11:39,500 And if I actually go ahead and delete all of these, leave it to kind of the default and we go back 175 00:11:39,500 --> 00:11:40,790 into the lighting service. 176 00:11:40,790 --> 00:11:43,160 You'll see we got this new section right here. 177 00:11:43,520 --> 00:11:44,600 Fog. 178 00:11:44,810 --> 00:11:48,670 Now, the fog here you can use to create some fog. 179 00:11:48,680 --> 00:11:52,610 So it has a starting point and an ending point. 180 00:11:52,850 --> 00:11:57,230 And we can set this ending point to be something closer, like 100 studs away. 181 00:11:58,250 --> 00:12:01,600 And basically our starting point is at our camera. 182 00:12:01,610 --> 00:12:06,800 And the further we get away from the camera, the fog gets thicker and thicker until it reaches the 183 00:12:06,800 --> 00:12:08,780 max point, which is 100 studs away. 184 00:12:08,780 --> 00:12:11,020 And that's when the fog becomes the thickest. 185 00:12:11,030 --> 00:12:15,770 If you want to create a zone around the player that isn't foggy, you could set this fog start to be 186 00:12:15,770 --> 00:12:16,990 something like ten. 187 00:12:17,000 --> 00:12:21,950 And as you can see, I have a ten stud zone around me where there isn't any fog. 188 00:12:21,950 --> 00:12:27,010 It only starts becoming foggy after it hits or exceeds that ten stud limit. 189 00:12:27,020 --> 00:12:32,690 And of course, you can also change the color of your fog as well to whatever color you'd like. 190 00:12:32,900 --> 00:12:33,770 So yeah. 191 00:12:34,610 --> 00:12:35,420 Kind of cool. 192 00:12:36,050 --> 00:12:39,770 The lighting service, as you can see, is pretty neat and you can change a lot of stuff in here to 193 00:12:39,770 --> 00:12:41,330 change the lighting of your game. 194 00:12:41,690 --> 00:12:44,750 Other than that, that's all I have for you in this lecture.